/**
 * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 * 
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.xtend.core.tests.compiler;

import org.eclipse.xtend2.lib.StringConcatenation;
import org.junit.Test;

/**
 * @author Sebastian Zarnekow - Initial contribution and API
 */
@SuppressWarnings("all")
public class CompilerBug465058Test extends AbstractXtendCompilerTest {
  @Test
  public void test_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.<String>head]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return IterableExtensions.<String>head(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_02() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = newArrayList(\'a\', \'b\')");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[ list.<String>head ]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final ArrayList<String> list = CollectionLiterals.<String>newArrayList(\"a\", \"b\");");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return IterableExtensions.<String>head(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_03() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return IterableExtensions.<String>head(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_04() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = newArrayList(\'a\', \'b\')");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[ list.head ]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final ArrayList<String> list = CollectionLiterals.<String>newArrayList(\"a\", \"b\");");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return IterableExtensions.<String>head(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_05() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_06() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(Iterable<? extends T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final Iterable<? extends T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_07() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(((String[])Conversions.unwrapArray(Bug.this.list, String.class)));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_08() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[\"one\", \"two\", \"three\"])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(new String[] { \"one\", \"two\", \"three\" });");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_09() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(list)]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_11() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(Iterable<? extends T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final Iterable<? extends T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_12() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[list.head2]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(((String[])Conversions.unwrapArray(Bug.this.list, String.class)));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_13() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[\"one\", \"two\", \"three\"])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(new String[] { \"one\", \"two\", \"three\" });");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_14() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(list)]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_15() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val list = #[\"one\", \"two\", \"three\"]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("var =>Object x = [head2(list)]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("x.apply");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("private final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\"));");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(Bug.this.list);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Function0<?> x = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("x.apply();");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_16() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("var =>Object x = [head2(#[\"one\", \"two\", \"three\"])]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("x.apply");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(Iterable<T> iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Object bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Object _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return Bug.this.<String>head2(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(\"one\", \"two\", \"three\")));");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Function0<?> x = _function;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = x.apply();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final Iterable<T> iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_17() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("var =>Object x = [head2(#[\"one\", \"two\", \"three\"])]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("x.apply()");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends CharSequence> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Object bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Object _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return Bug.this.<String>head2(new String[] { \"one\", \"two\", \"three\" });");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Function0<?> x = _function;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = x.apply();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends CharSequence> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_18() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[1, 1.0])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(T[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return ((Number)Bug.this.<Number>head2(new Number[] { Integer.valueOf(1), Double.valueOf(1.0) }));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final T[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_19() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[\'\', \'\'])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T> T head2(Comparable<T>[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Bug.this.<String>head2(new Comparable[] { \"\", \"\" });");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> T head2(final Comparable<T>[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_20() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[null as Integer, null as Double])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends Number> T head2(Comparable<? extends T>[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return ((Number)Bug.this.<Number>head2(new Comparable[] { ((Integer) null), ((Double) null) }));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Number> T head2(final Comparable<? extends T>[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_21() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Bug {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def void foo(=>Object f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("foo[head2(#[1, 1.0])]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def <T extends Number> T head2(Comparable<? extends T>[] iterable) {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public abstract class Bug {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public abstract void foo(final Function0<?> f);");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void bar() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function0<Object> _function = new Function0<Object>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public Object apply() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return ((Number)Bug.this.<Number>head2(new Comparable[] { Integer.valueOf(1), Double.valueOf(1.0) }));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.foo(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Number> T head2(final Comparable<? extends T>[] iterable) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }
}
